<template>
  <div class="Br">
    <div class="curr_back">
      <img src="../../../static/image/currentduan.png" />
    </div>
    <div>
      <div class="Branch" v-for="(item, index) in Arr" :key="index">
        <div class="nav" @click="goOrder(item.branchId, item.branchName)">
          <div
            style="background:#fff;height:1.65rem;border-radius:0.2rem;box-sizing:border-box;"
          >
            <span style="margin-left:0.30rem;font-size:0.32rem;color:#212C67;">
              {{ item.branchName }}
            </span>
            <div class="nav_item" style="font-size:0.24rem;">
              <span>销售总额</span>
              <span>昨日销售</span>
            </div>
          </div>
        </div>
      </div>
      <footer>
        <Footers></Footers>
      </footer>
    </div>
  </div>
</template>
<script>
import Footers from "../footer";
import { branchList } from "../../api/api";
import { InfiniteScroll, Toast } from "mint-ui";

export default {
  name: "HelloWorld",
  components: {
    Footers
  },
  data() {
    return {
      Arr: [],
      branchName: "",
      branchId: "",
      pageNo: 1,
      queryLoading: true,
      moreLoading: false,
      allLoaded: false
    };
  },
  methods: {
    branchListone() {
      let that = this;
      that.bus.$emit("loading", true); //开始
      let params = {};
      let a = localStorage.getItem("token");
      a = JSON.parse(a);
      branchList(params, a).then(res => {
        if (res.data.code == 0) {
          Toast(res.data.message);
        } else {
          let arr = res.data.data;
          that.Arr = arr;
          console.log(that.Arr);
          for (let i = 0; i < that.Arr.length; i++) {
            that.branchId = that.Arr[i].branchId;
            that.branchName = that.Arr[i].branchName;
          }
          // that.branchId=res.data.data.branchId;
        }
        that.bus.$emit("loading", false); //结束
      });
    },
    goOrder(e, i) {
      this.$router.push({
        path: "/Generalhospital/Branchdetails",
        query: { branchId: e, branchName: i }
      });
    }
  },
  mounted() {
    this.branchListone();
  }
};
</script>
<style lang="scss" scoped>
.Br {
  width: 100%;
  height: auto;
  padding-bottom: 1.5rem;
}
.Branch {
  width: 100%;
  height: auto;
  background: #f8f9fc;
  padding-top: 0.2rem;
  box-sizing: border-box;
}
.nav {
  width: 6.94rem;
  height: auto;
  margin: auto;
  border-radius: 0.2rem;
  border: 0.02rem solid #cfcfcf;
}
.curr_back {
  width: 100%;
  height: 1.7rem;
  position: relative;
}
.curr_back img {
  width: 100%;
  height: 100%;
}
.nav_item {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0.3rem 0 0.4rem;
  font-size: 0.32rem;
}
.nav_item1 {
  display: flex;
  justify-content: space-between;
  height: 1.16rem;
  background: #e8ebf5;
  border-radius: 0 0 0.2rem 0.2rem;
  line-height: 1rem;
  padding: 0 0.2rem 0 0.2rem;
  font-size: 0.42rem;
}
.nav_item1 view:nth-of-type(1) {
  text-align: center;
}
.nav_item1 view:nth-last-of-type(1) {
  width: 1.12rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>